<?php
/**
 * @copyright meila.com
 * @author 新华@
 * 删除pic_feed,ilike,
 * @name
 * @param
 *         $xxx = 作用
 * @static
 *         XXX = 作用
 *
 *
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_del_like_feed extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_DEL_LIKE_FEED;
    private $ILike ;
    private $LikeMe ;
    private $pic_feed;
    private $pub_feed;
    private $rid;
    protected  $uid;
    private $aUid;//喜欢我宝贝的人的uids
    public function __construct($queue)
    {
        $this->ILike = new ml_model_dbILike();
        $this->LikeMe = new ml_model_dbLikeMe();
        $this->pic_feed = new ml_model_dbPicFeed();
        $this->oUserFeed = new ml_model_dbUserfeed();
        $this->pub_feed = new ml_model_dbPublicFeed();

        parent::__construct($queue);
    }

    public function run_job(){
        //接收的数据
        $arr = $this->src_data;
        $this->rid=$arr['rid'];
        //rid类型是feed，只删pub_feed
        if(ml_tool_resid::resid2type($this->rid) == ML_RESID_TYPE_USERFEED){
            $this->pub_feed->delByUserFeedId($this->rid);    
        }
        //删宝贝=》删like，pic_feed,pub_feed
        else{
            $this->uid=ml_tool_resid::resid2uid($this->rid);
            $re = $this->LikeMe->getUidsByRid($this->uid, $this->rid,ML_ATTITUDE_LOVE,$uids);
             
            foreach ($uids as $value) {
                $this->aUid[]=$value['act_uid'];
            }

            $this->ILike->update_when_del_content($this->aUid,$this->rid);//删ilike
             
            $this->pic_feed->delByContent_rid($this->rid);//删feed
            $this->pub_feed->delByContent_rid($this->rid);
        }
        return true;
    }

}

ml_run_queue_check(ml_mq_del_like_feed::QUEUE_NAME);
$xblog_obj = new ml_mq_del_like_feed(new McQueue(ml_mq_del_like_feed::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>